Call:
randomForest(formula = AttritionN ~ ., data = training, ntree = 300, mtry = 8, importance = TRUE, proximity = TRUE)
Type of random forest: classification
Number of trees: 300
No. of variables tried at each split: 8
OOB estimate of error rate: 13.96%
Confusion matrix:
0 1 class.error
0 880 13 0.01455767
1 135 32 0.80838323
$names
[1] "call" "type" "predicted"
[4] "err.rate" "confusion" "votes"
[7] "oob.times" "classes" "importance"
[10] "importanceSD" "localImportance" "proximity"
[13] "ntree" "mtry" "forest"
[16] "y" "test" "inbag"
[19] "terms"
$class
[1] "randomForest.formula" "randomForest"
Confusion Matrix and Statistics
Reference
Prediction 0 1
0 893 0
1 0 167
Accuracy : 1
95% CI : (0.9965, 1)
No Information Rate : 0.8425
P-Value [Acc > NIR] : < 2.2e-16
Kappa : 1
Mcnemar's Test P-Value : NA
Sensitivity : 1.0000
Specificity : 1.0000
Pos Pred Value : 1.0000
Neg Pred Value : 1.0000
Prevalence : 0.8425
Detection Rate : 0.8425
Detection Prevalence : 0.8425
Balanced Accuracy : 1.0000
'Positive' Class : 0
Confusion Matrix and Statistics
Reference
Prediction 0 1
0 339 58
1 1 12
Accuracy : 0.8561
95% CI : (0.8183, 0.8886)
No Information Rate : 0.8293
P-Value [Acc > NIR] : 0.08188
Kappa : 0.249
Mcnemar's Test P-Value : 3.086e-13
Sensitivity : 0.9971
Specificity : 0.1714
Pos Pred Value : 0.8539
Neg Pred Value : 0.9231
Prevalence : 0.8293
Detection Rate : 0.8268
Detection Prevalence : 0.9683
Balanced Accuracy : 0.5842
'Positive' Class : 0
left daughter right daughter split var split point
1 2 3 JobLevel 1.5
2 4 5 OverTimeN 0.5
3 6 7 YearsAtCompany 3.5
4 8 9 JobRole_N 1.5
5 10 11 DistanceFromHome 2.5
6 12 13 WorkLifeBalance 2.5
7 14 15 StockOptionLevel 0.5
8 16 17 EnvironmentSatisfaction 3.5
9 18 19 TotalWorkingYears 2.5
10 20 21 EnvironmentSatisfaction 1.5
11 22 23 RelationshipSatisfaction 2.5
12 24 25 MonthlyIncome 4500.5
13 26 27 MonthlyRate 21630.0
14 28 29 DistanceFromHome 24.5
15 30 31 Age 46.5
16 32 33 PercentSalaryHike 16.0
17 34 35 EducationFieldN 5.0
18 36 37 JobRole_N 3.5
19 38 39 YearsWithCurrManager 1.5
20 40 41 JobSatisfaction 3.0
21 42 43 YearsWithCurrManager 0.5
22 44 45 DistanceFromHome 9.5
23 46 47 PerformanceRating 3.5
24 48 49 MonthlyRate 15694.5
25 50 51 DailyRate 1159.5
26 52 53 JobSatisfaction 3.5
27 54 55 DepartmentN 1.5
28 56 57 MonthlyRate 26770.5
29 58 59 HourlyRate 52.5
30 60 61 MonthlyRate 2574.5
31 62 63 Age 48.0
32 64 65 DistanceFromHome 16.0
33 66 67 NumCompaniesWorked 5.5
34 0 0 <NA> 0.0
35 0 0 <NA> 0.0
36 68 69 PercentSalaryHike 19.5
37 70 71 DailyRate 355.5
38 72 73 MonthlyRate 9606.5
39 74 75 DistanceFromHome 28.5
40 0 0 <NA> 0.0
41 0 0 <NA> 0.0
42 76 77 EnvironmentSatisfaction 3.0
43 78 79 HourlyRate 93.0
44 0 0 <NA> 0.0
45 80 81 Education 1.5
46 82 83 NumCompaniesWorked 4.5
47 84 85 EnvironmentSatisfaction 1.5
48 0 0 <NA> 0.0
49 0 0 <NA> 0.0
50 86 87 PercentSalaryHike 13.5
51 88 89 YearsSinceLastPromotion 1.0
52 90 91 EducationFieldN 2.5
53 0 0 <NA> 0.0
54 92 93 RelationshipSatisfaction 2.5
55 94 95 JobSatisfaction 2.0
56 96 97 DepartmentN 1.5
57 0 0 <NA> 0.0
58 0 0 <NA> 0.0
59 98 99 YearsSinceLastPromotion 10.0
60 100 101 MonthlyIncome 7560.5
61 102 103 EnvironmentSatisfaction 3.5
62 104 105 DailyRate 434.0
63 106 107 Education 3.5
64 0 0 <NA> 0.0
65 0 0 <NA> 0.0
66 108 109 YearsSinceLastPromotion 1.0
67 0 0 <NA> 0.0
68 110 111 RelationshipSatisfaction 2.0
69 112 113 EnvironmentSatisfaction 2.5
70 0 0 <NA> 0.0
71 0 0 <NA> 0.0
72 0 0 <NA> 0.0
73 114 115 Age 28.5
74 116 117 DailyRate 114.5
75 0 0 <NA> 0.0
76 0 0 <NA> 0.0
77 0 0 <NA> 0.0
78 118 119 DepartmentN 1.5
79 0 0 <NA> 0.0
80 0 0 <NA> 0.0
81 0 0 <NA> 0.0
82 120 121 StockOptionLevel 0.5
83 122 123 YearsAtCompany 1.5
84 124 125 Age 38.0
85 0 0 <NA> 0.0
86 0 0 <NA> 0.0
87 126 127 EnvironmentSatisfaction 1.5
88 0 0 <NA> 0.0
89 0 0 <NA> 0.0
90 128 129 DailyRate 694.5
91 130 131 RelationshipSatisfaction 2.5
92 132 133 Education 3.5
93 0 0 <NA> 0.0
94 0 0 <NA> 0.0
95 134 135 GenderN 0.5
96 136 137 Age 57.0
97 138 139 WorkLifeBalance 2.5
98 0 0 <NA> 0.0
99 0 0 <NA> 0.0
100 0 0 <NA> 0.0
101 0 0 <NA> 0.0
102 0 0 <NA> 0.0
103 140 141 YearsInCurrentRole 2.5
104 0 0 <NA> 0.0
105 0 0 <NA> 0.0
106 142 143 YearsAtCompany 5.5
107 0 0 <NA> 0.0
108 0 0 <NA> 0.0
109 0 0 <NA> 0.0
110 0 0 <NA> 0.0
111 144 145 BusinessTravelN 1.5
112 0 0 <NA> 0.0
113 0 0 <NA> 0.0
114 0 0 <NA> 0.0
115 146 147 HourlyRate 83.5
116 0 0 <NA> 0.0
117 148 149 NumCompaniesWorked 0.5
118 150 151 WorkLifeBalance 1.5
119 152 153 DistanceFromHome 1.5
120 154 155 RelationshipSatisfaction 3.5
121 0 0 <NA> 0.0
122 0 0 <NA> 0.0
123 0 0 <NA> 0.0
124 0 0 <NA> 0.0
125 0 0 <NA> 0.0
126 0 0 <NA> 0.0
127 0 0 <NA> 0.0
128 0 0 <NA> 0.0
129 0 0 <NA> 0.0
130 156 157 StockOptionLevel 0.5
131 0 0 <NA> 0.0
132 158 159 GenderN 0.5
133 0 0 <NA> 0.0
134 0 0 <NA> 0.0
135 0 0 <NA> 0.0
136 160 161 TrainingTimesLastYear 1.5
137 162 163 YearsSinceLastPromotion 12.0
138 164 165 RelationshipSatisfaction 3.5
139 166 167 HourlyRate 62.5
140 168 169 DailyRate 361.0
141 0 0 <NA> 0.0
142 170 171 JobInvolvement 3.5
143 172 173 TotalWorkingYears 9.5
144 174 175 DailyRate 250.0
145 0 0 <NA> 0.0
146 176 177 NumCompaniesWorked 4.5
147 178 179 YearsSinceLastPromotion 0.5
148 180 181 EducationFieldN 2.0
149 182 183 PercentSalaryHike 12.5
150 184 185 RelationshipSatisfaction 3.0
151 0 0 <NA> 0.0
152 0 0 <NA> 0.0
153 0 0 <NA> 0.0
154 186 187 PercentSalaryHike 13.5
155 188 189 DailyRate 931.5
156 190 191 Education 3.0
157 0 0 <NA> 0.0
158 0 0 <NA> 0.0
159 0 0 <NA> 0.0
160 192 193 MonthlyIncome 18858.5
161 194 195 JobSatisfaction 2.5
162 0 0 <NA> 0.0
163 0 0 <NA> 0.0
164 196 197 DistanceFromHome 11.0
165 0 0 <NA> 0.0
166 0 0 <NA> 0.0
167 198 199 HourlyRate 64.5
168 0 0 <NA> 0.0
169 0 0 <NA> 0.0
170 200 201 DailyRate 773.0
171 0 0 <NA> 0.0
172 0 0 <NA> 0.0
173 0 0 <NA> 0.0
174 0 0 <NA> 0.0
175 0 0 <NA> 0.0
176 0 0 <NA> 0.0
177 0 0 <NA> 0.0
178 0 0 <NA> 0.0
179 0 0 <NA> 0.0
180 0 0 <NA> 0.0
181 0 0 <NA> 0.0
182 202 203 HourlyRate 36.0
183 0 0 <NA> 0.0
184 0 0 <NA> 0.0
185 0 0 <NA> 0.0
186 0 0 <NA> 0.0
187 0 0 <NA> 0.0
188 0 0 <NA> 0.0
189 0 0 <NA> 0.0
190 0 0 <NA> 0.0
191 0 0 <NA> 0.0
192 204 205 TotalWorkingYears 9.5
193 0 0 <NA> 0.0
194 206 207 Education 3.5
195 0 0 <NA> 0.0
196 208 209 MonthlyRate 20889.5
197 0 0 <NA> 0.0
198 0 0 <NA> 0.0
199 210 211 YearsInCurrentRole 2.5
200 0 0 <NA> 0.0
201 0 0 <NA> 0.0
202 0 0 <NA> 0.0
203 212 213 HourlyRate 82.5
204 0 0 <NA> 0.0
205 0 0 <NA> 0.0
206 0 0 <NA> 0.0
207 214 215 MonthlyIncome 5074.5
208 216 217 YearsInCurrentRole 4.0
209 0 0 <NA> 0.0
210 218 219 PercentSalaryHike 15.5
211 0 0 <NA> 0.0
212 0 0 <NA> 0.0
213 220 221 EnvironmentSatisfaction 3.0
214 0 0 <NA> 0.0
215 0 0 <NA> 0.0
216 0 0 <NA> 0.0
217 0 0 <NA> 0.0
218 0 0 <NA> 0.0
219 0 0 <NA> 0.0
220 0 0 <NA> 0.0
221 0 0 <NA> 0.0
status prediction
1 1 <NA>
2 1 <NA>
3 1 <NA>
4 1 <NA>
5 1 <NA>
6 1 <NA>
7 1 <NA>
8 1 <NA>
9 1 <NA>
10 1 <NA>
11 1 <NA>
12 1 <NA>
13 1 <NA>
14 1 <NA>
15 1 <NA>
16 1 <NA>
17 1 <NA>
18 1 <NA>
19 1 <NA>
20 1 <NA>
21 1 <NA>
22 1 <NA>
23 1 <NA>
24 1 <NA>
25 1 <NA>
26 1 <NA>
27 1 <NA>
28 1 <NA>
29 1 <NA>
30 1 <NA>
31 1 <NA>
32 1 <NA>
33 1 <NA>
34 -1 0
35 -1 1
36 1 <NA>
37 1 <NA>
38 1 <NA>
39 1 <NA>
40 -1 1
41 -1 0
42 1 <NA>
43 1 <NA>
44 -1 1
45 1 <NA>
46 1 <NA>
47 1 <NA>
48 -1 1
49 -1 0
50 1 <NA>
51 1 <NA>
52 1 <NA>
53 -1 0
54 1 <NA>
55 1 <NA>
56 1 <NA>
57 -1 1
58 -1 0
59 1 <NA>
60 1 <NA>
61 1 <NA>
62 1 <NA>
63 1 <NA>
64 -1 1
65 -1 0
66 1 <NA>
67 -1 1
68 1 <NA>
69 1 <NA>
70 -1 0
71 -1 1
72 -1 0
73 1 <NA>
74 1 <NA>
75 -1 1
76 -1 0
77 -1 1
78 1 <NA>
79 -1 1
80 -1 0
81 -1 1
82 1 <NA>
83 1 <NA>
84 1 <NA>
85 -1 1
86 -1 0
87 1 <NA>
88 -1 0
89 -1 1
90 1 <NA>
91 1 <NA>
92 1 <NA>
93 -1 0
94 -1 1
95 1 <NA>
96 1 <NA>
97 1 <NA>
98 -1 1
99 -1 0
100 -1 0
101 -1 1
102 -1 0
103 1 <NA>
104 -1 0
105 -1 1
106 1 <NA>
107 -1 0
108 -1 1
109 -1 0
110 -1 1
111 1 <NA>
112 -1 1
113 -1 0
114 -1 1
115 1 <NA>
116 -1 1
117 1 <NA>
118 1 <NA>
119 1 <NA>
120 1 <NA>
121 -1 0
122 -1 0
123 -1 1
124 -1 1
125 -1 0
126 -1 1
127 -1 0
128 -1 0
129 -1 1
130 1 <NA>
131 -1 0
132 1 <NA>
133 -1 0
134 -1 1
135 -1 0
136 1 <NA>
137 1 <NA>
138 1 <NA>
139 1 <NA>
140 1 <NA>
141 -1 0
142 1 <NA>
143 1 <NA>
144 1 <NA>
145 -1 1
146 1 <NA>
147 1 <NA>
148 1 <NA>
149 1 <NA>
150 1 <NA>
151 -1 0
152 -1 1
153 -1 0
154 1 <NA>
155 1 <NA>
156 1 <NA>
157 -1 0
158 -1 0
159 -1 1
160 1 <NA>
161 1 <NA>
162 -1 0
163 -1 1
164 1 <NA>
165 -1 0
166 -1 0
167 1 <NA>
168 -1 1
169 -1 0
170 1 <NA>
171 -1 0
172 -1 1
173 -1 0
174 -1 1
175 -1 0
176 -1 0
177 -1 1
178 -1 0
179 -1 1
180 -1 1
181 -1 0
182 1 <NA>
183 -1 0
184 -1 0
185 -1 1
186 -1 1
187 -1 0
188 -1 0
189 -1 1
190 -1 1
191 -1 0
192 1 <NA>
193 -1 1
194 1 <NA>
195 -1 0
196 1 <NA>
197 -1 1
198 -1 1
199 1 <NA>
200 -1 1
201 -1 0
202 -1 1
203 1 <NA>
204 -1 1
205 -1 0
206 -1 0
207 1 <NA>
208 1 <NA>
209 -1 1
210 1 <NA>
211 -1 0
212 -1 0
213 1 <NA>
214 -1 1
215 -1 0
216 -1 1
217 -1 0
218 -1 0
219 -1 1
220 -1 1
221 -1 0
0.004873494 0.05
-0.05946155 0.05
---
title: "Attrition Predictor Analysis"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
social: ["github","linkedin"]
source_code: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
library(knitr)
library(DT)
library(rpivotTable)
library(ggplot2)
library(plotly)
library(dplyr)
library(openintro)
library(highcharter)
library(ggvis)
library(broom)
```
```{r, message=FALSE}
#"data" has categorical data converted to numerical
# "data2" has a mixed data types
data <- read.csv("~/Documents/Projects/SMU/rProjects/CaseStudy_02/CaseStudy_02/NumData.csv")
data2 <- read.csv("~/Documents/Projects/SMU/rProjects/CaseStudy_02/CaseStudy_02/CaseStudy2-data.csv")
#View(data)
#str(data)
```
```{r echo=FALSE}
# embed all Rmd and csv files
xfun::embed_files(list.files('.', '[.](Rmd|csv)$'))
```
```{r}
mycolors <- c("blue", "#FFC125", "darkgreen", "darkorange", "darkblue")
```
About Report
========================================
Attrition Predictor Analysis

Project By:
Heindel Adu, Stephen Johnson, Ross Fu, Anthony Yeung
Classification:
CONFIDENTIAL REPORT!
Int Data Viz
=====================================
Row
-------------------------------------
### Attrition Count
```{r}
valueBox(paste("Attrition"),
color = "darkblue")
#unique.(data$Attrition)
#data %>%
# summarise(Attrition = n())
```
### Number of Employee Data Reviewed
```{r}
valueBox(length(data$Attrition),
icon = "fa-users")
```
### **Monthly Income**
```{r}
gauge(round(min(data$MonthlyIncome),
digits = 2),
min = 0,
max = 25000,
label = "Min Monthly Income",
gaugeSectors(success = c(15000, 25000),
warning = c(5000,15000),
danger = c(0, 5000),
colors = c("green", "yellow", "red")))
```
```{r}
gauge(round(mean(data$MonthlyIncome),
digits = 2),
min = 0,
max = 25000,
label = "Avg Monthly Income",
gaugeSectors(success = c(15000, 25000),
warning = c(5000,15000),
danger = c(0, 5000),
colors = c("green", "yellow", "red")))
```
```{r}
gauge(round(max(data$MonthlyIncome),
digits = 2),
min = 0,
max = 25000,
label = "Max Monthly Income",
gaugeSectors(success = c(15000, 25000),
warning = c(5000,15000),
danger = c(0, 5000),
colors = c("green", "yellow", "red")))
```
### Yes on Attrition
```{r, Yes}
valueBox(sum(data$Attrition == "Yes"),
icon = 'fa-user-o')
```
### No on Attrition
```{r, No}
valueBox(sum(data$Attrition == "No"),
icon = 'fa-user')
```
Row
-------------------------------------------------
### **Plotly Bar Plot **
```{r}
#summary(data2$Attrition)
#str(data2$Attrition)
#p0 <- ggplot2::data2 %>% sum(JobRole, Attrition) %>%
# plot_ly(x = ~JobRole, y = ~n, color = ~Attrition)
p1 <- data2 %>%
group_by(JobRole) %>%
summarise(count = n()) %>%
plot_ly(x = ~JobRole,
y = ~count,
color = 'blue',
type = 'bar') %>%
layout(xaxis = list(title = "Job Role"),
yaxis = list(title = 'Count'))
p1
#names(data2)
```
### **Plotly Box Plot of Job Role & Income**
```{r}
data2 %>%
group_by(JobRole) %>%
plot_ly(y = ~JobRole, x = ~MonthlyIncome, type = "box", boxpoints = "outliers", color = ~JobRole, jitter = 0.3, pointpos = 0, orientation = "h")
```
Scatter Plots
=====================================
Row
-------------------------------------
### **Monthly Income v Age**
```{r}
j <- loess(MonthlyIncome ~ Age, data = data2)
p2 <- plot_ly(data = data2, x = ~Age,
y = ~MonthlyIncome,
color = as.factor(data2$Attrition),
type = 'scatter', alpha = 0.9) %>%
add_lines(y= ~fitted(loess(data2$MonthlyIncome ~ data2$Age)),
line = list(color = 'rgba(7,164,181,1)'),
name = "Loess Smoother") %>%
add_ribbons(data = augment(j),
ymin = ~.fitted - 1.96 * .se.fit,
ymax = ~.fitted + 1.96 * .se.fit,
line = list(color = 'rgba(7, 164, 181, 0.05)'),
fillcolor = 'rgba(7, 164, 181, 0.2)',
name = "Standard Error") %>%
layout(xaxis = list(title = "Age"),
yaxis = list(title = 'Monthly Income'))
p2
```
### **Monthly Income v Time in C. Role**
```{r}
l <- loess(MonthlyIncome ~ YearsInCurrentRole, data = data2)
p3 <- plot_ly(data = data2, x = ~YearsInCurrentRole,
y = ~MonthlyIncome,
color = as.factor(data2$Attrition),
type = 'scatter', alpha = 0.9) %>%
add_lines(y= ~fitted(loess(data2$MonthlyIncome ~ data2$YearsInCurrentRole)),
line = list(color = 'rgba(7,164,181,1)'),
name = "Loess Smoother") %>%
add_ribbons(data = augment(l),
ymin = ~.fitted - 1.96 * .se.fit,
ymax = ~.fitted + 1.96 * .se.fit,
line = list(color = 'rgba(7, 164, 181, 0.05)'),
fillcolor = 'rgba(7, 164, 181, 0.2)',
name = "Standard Error") %>%
layout(xaxis = list(title = "Years In Current Role"),
yaxis = list(title = 'Monthly Income'))
p3
```
### **Monthly Income v Time At Company **
```{r}
k <- loess(MonthlyIncome ~ YearsAtCompany, data = data2)
p5 <- plot_ly(data = data2, x = ~YearsAtCompany,
y = ~MonthlyIncome,
color = as.factor(data2$Attrition),
type = 'scatter', alpha = 0.9) %>%
add_lines(y= ~fitted(loess(data2$MonthlyIncome ~ data2$YearsAtCompany)),
line = list(color = 'rgba(7,164,181,1)'),
name = "Loess Smoother") %>%
add_ribbons(data = augment(k),
ymin = ~.fitted - 1.96 * .se.fit,
ymax = ~.fitted + 1.96 * .se.fit,
line = list(color = 'rgba(7, 164, 181, 0.05)'),
fillcolor = 'rgba(7, 164, 181, 0.2)',
name = "Standard Error") %>%
layout(xaxis = list(title = "Years At Company"),
yaxis = list(title = 'Monthly Income'))
p5
```
Row
---------------------------------------------
Comparison of Monthly Income with other variables.
- Age
- Time in Current Role
- Time with Company
```{r}
### **Box Plot of Top State**
#data2 %>%
# group_by(JobRole) %>%
# ggvis(~JobRole, ~MonthlyIncome, fill = ~JobRole) %>%
# layer_boxplots()
```
Data Table
========================================
```{r}
datatable(data2,
caption = "Attrition Data",
rownames = TRUE,
filter = "top",
options = list(pageLength = 25))
```
Pivot Table - Mixed
=========================================
```{r}
rpivotTable(data2,
aggregatorName = "Count",
cols= "Attrition",
rows = "JobRole",
rendererName = "Heatmap")
```
R Forest
========================================
```{r}
#View(data)
#names(data)
# Partition Data
#str(data$AttritionN)
data$AttritionN <- as.factor(data$AttritionN)
rfdata <-data[1:34]
#names(rfdata)
# Data Partition
set.seed(111)
ind <- sample(2, nrow(rfdata), replace = TRUE, prob = c(0.7, 0.3))
training <- rfdata[ind==1,]
testing <- rfdata[ind==2,]
# Random Forest
library(randomForest)
set.seed(222)
rf <- randomForest(AttritionN~., data=training,
ntree = 300,
mtry = 8,
importance = TRUE,
proximity = TRUE)
```
Row
----------------------------------------
### **RF Parameters **
```{r}
print(rf)
```
### **RF Attributes **
```{r}
attributes(rf)
```
Row
--------------------------------
### **Error Rate **
```{r}
# Error rate of Random Forest
plot(rf)
```
### **# Nodes for the Trees **
```{r}
# No. of nodes for the trees
hist(treesize(rf),
main = "No. of Nodes for the Trees",
col = "lightblue")
```
Matrix
======================================
Row
--------------------------------------
### **Training C-Matrix **
```{r}
# Prediction & Confusion Matrix - training data
library(caret)
p9 <- predict(rf, training)
confusionMatrix(p9, training$AttritionN)
```
### **Testing C-Matrix **
```{r}
# # Prediction & Confusion Matrix - testing data
p10 <- predict(rf, testing)
confusionMatrix(p10, testing$AttritionN)
```
RF Plots
========================================
Row
--------------------------------
### **Variable Importance - Top 10 **
```{r}
# Variable Importance
varImpPlot(rf,
sort = T,
n.var = 10,
main = "Top 10 - Variable Importance")
#importance(rf)
```
### **Partial Dependence **
```{r}
# Partial Dependence Plot
partialPlot(rf, training, OverTimeN, "1")
```
### **Multi-dim Scaling Plot of Proximity**
```{r}
# Multi-dimensional Scaling Plot of Proximity Matrix
MDSplot(rf, training$AttritionN)
```
Row
---------------------------------------------
### **Single Tree **
```{r}
# Extract Single Tree
getTree(rf, 1, labelVar = TRUE)
```
### **Tune Mtry **
```{r}
# Tune mtry
t <- tuneRF(training[,-31], training[,31],
stepFactor = 0.5,
plot = TRUE,
ntreeTry = 300,
trace = FALSE,
improve = 0.05)
```